package org.example.buysystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.buysystem.entity.Order;

import java.util.List;
import java.util.Map;

@Mapper

public interface OrderMapper extends BaseMapper<Order> {
    List<Map<String,Object>> findByUserId(int userid);

    @Select("select order_no from t_order where totalorder_no=#{totalorderNo}")
    List<String> findByTotalOrderNo(String totalorderNo);

    @Update("update t_order set state='已支付' where order_no=#{orderNo}")
    void payOrder(String orderNo);

    Map<String, Object> selectByOrderNo(String orderNo);

    @Update("update t_order set state='已收货' where totalorder_no=#{totalorderNo}")
    boolean receivedOrder(String totalorderNo);

    @Select("select order_no from t_order where totalorder_no = #{totalorderNo}")
    List<String> selectByOrderNoTotal(String totalorderNo);
}
